let bodyParser = require('body-parser');
let express = require('express');
let path = require('path')
// 引入session中间件
let session = require('express-session')
let { ROOT, STATICS } = require('./index')
module.exports = app => {
    // console.log(111);
	// 安装session中间件
	app.use(session({
		resave: true,
		secret: 'iulove',
		saveUninitialized: false
	}))
	// 解析body
    app.use(bodyParser.json())
    // 静态化   
    for(let key in STATICS) {
        app.use(key, express.static(path.join(ROOT, STATICS[key])))
    }
    // 配置引擎
    app.engine('.html', require('ejs').__express)
}